#ifndef MYGRAPHICLINE_H
#define MYGRAPHICLINE_H

#include "mygraphicellipse.h"

#include <QWidget>
#include <QPainter>
#include <QPen>
#include <cmath>

class MyGraphicLine : public QWidget
{
    Q_OBJECT

    enum LineDirect{LEFT_UP_RIGHT_DOWN, UP_MIDDLE_DOWN_MIDDLE, RIGHT_UP_LEFT_DOWN, LEFT_MIDDLE_RIGHT_MIDDLE};

    MyGraphicEllipse* ellipse1;
    MyGraphicEllipse* ellipse2;

    bool lineDirection; // true: 从左上到右下，false：从右上到左下
    LineDirect lineDirect;

public:
    explicit MyGraphicLine(QWidget *parent = nullptr);

    void setEllipse1(MyGraphicEllipse* ellipse);
    void setEllipse2(MyGraphicEllipse* ellipse);

    void resizeMyWidget(); // 根据直线的起始点和终止点修改窗体大小
    void removeEllipseLineIndex(int index); // 删除连接圆中的索引
protected:
    void paintEvent(QPaintEvent *event) override;

signals:

public slots:
};

#endif // MYGRAPHICLINE_H
